package top.hkyzf.study.leetcode.string;

import org.junit.Test;

/**
 * @author 朱峰
 * @date 2022-1-16 14:36
 */
public class 检测大写字母_520 {
    public boolean detectCapitalUse(String word) {
        char ch = word.charAt(0);
        String substring = word.substring(1);
        // 首字母小写
        if(Character.isLowerCase(ch)) {
            return substring.toLowerCase().equals(substring);
        } else {
            return substring.equals(substring.toLowerCase()) || substring.equals(substring.toUpperCase());
        }
    }

    @Test
    public void testDetectCapitalUse () {
        System.out.println(detectCapitalUse("L"));
    }
}
